/*
 * Main.fx
 *
 * Created on 07.03.2010, 0:28:47
 */

package javafx191labs.nkornilova.lab01;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.shape.*;
import javafx.scene.Group;
import javafx.scene.effect.*;
import javafx.scene.effect.light.*;
import javafx.animation.*;
import javafx.scene.paint.*;

class title2 {
var title1:String;
}

var title3 = title2 {
title1: "City"
};
def max_x = 1280; def max_x_sm=800;
def max_y = 750; def max_y_sm=600;
var x: Number;
var y: Number;
var ysun:Number;
var xship:Number;

Timeline {
         repeatCount: Timeline.INDEFINITE;
  autoReverse: true
  keyFrames: [
         KeyFrame{
         time: 0s
         values: x => (max_x-max_x_sm)/2+100;
         },

         KeyFrame{
         time: 7s
         values: x => (max_x-max_x_sm)/2+350
         tween Interpolator.LINEAR;
         }
  ]
}.play();

Timeline {
         repeatCount: Timeline.INDEFINITE;
  autoReverse: true
  keyFrames: [
         KeyFrame{
         time: 0s
         values: y => (max_y-max_y_sm)/2+100;
         },

         KeyFrame{
         time: 7s
         values: y => (max_y-max_y_sm)/2+20 tween Interpolator.LINEAR;
         }
  ]
}.play();

Timeline {
         repeatCount: Timeline.INDEFINITE;
  autoReverse: true
  keyFrames: [
         KeyFrame{
         time: 0ms
         values: ysun => 20;
         },

         KeyFrame{
         time: 100ms
         values: ysun => 30 //tween Interpolator.EASEBOTH;
         }
  ]
}.play();

Timeline {
         repeatCount: Timeline.INDEFINITE;
  autoReverse: true
  keyFrames: [
         KeyFrame{
         time: 0s
         values: xship => (max_x-max_x_sm)/2-200;
         },

         KeyFrame{
         time: 10s
         values: xship => (max_y-max_y_sm)/2+100 tween Interpolator.LINEAR;
         }
  ]
}.play();

/**
 * @author владелец
 */

Stage {

    title: title3.title1;
    scene: Scene {

        width: max_x
        height: max_y

        content: 
        [


            Rectangle {
                        x: (max_x-max_x_sm)/2, y: (max_y-max_y_sm)/2
                        width: max_x_sm, height: max_y_sm
                        fill: Color.LIGHTSKYBLUE;
                        effect: Lighting {
        light: DistantLight { azimuth: -100 }
        surfaceScale: 5
    }

                      }

           Arc {
                        centerX:(max_x-max_x_sm)/2+800 , centerY: (max_y-max_y_sm)/2+600
                        radiusX: 800, radiusY: 400
                        startAngle: 90, length: 90
                        fill: Color.AQUAMARINE
                         effect: MotionBlur { radius: 30 angle: -30 }
                }

            Polyline {
                        points : [ (max_x-max_x_sm)/2,(max_y-max_y_sm)/2+600-2, (max_x-max_x_sm)/2+800,(max_y-max_y_sm)/2+200-2, (max_x-max_x_sm)/2+800,(max_y-max_y_sm)/2+600, (max_x-max_x_sm)/2,(max_y-max_y_sm)/2+600]
                        //strokeWidth: 1.5;
                        stroke: Color.AQUAMARINE;
                        fill: Color.AQUAMARINE;
                    }
            Polyline {
                        points : [(max_x-max_x_sm)/2+200,(max_y-max_y_sm)/2+150, (max_x-max_x_sm)/2+280,(max_y-max_y_sm)/2+110, (max_x-max_x_sm)/2+280,(max_y-max_y_sm)/2+350, (max_x-max_x_sm)/2+200,(max_y-max_y_sm)/2+340, (max_x-max_x_sm)/2+200,(max_y-max_y_sm)/2+150]
                        strokeWidth: 2.0
                        stroke: Color.LIGHTSKYBLUE;
                        fill: Color.BISQUE;
                     }

            Polyline {
                        points : [(max_x-max_x_sm)/2+280,(max_y-max_y_sm)/2+110, (max_x-max_x_sm)/2+340,(max_y-max_y_sm)/2+105, (max_x-max_x_sm)/2+340,(max_y-max_y_sm)/2+340, (max_x-max_x_sm)/2+280,(max_y-max_y_sm)/2+350];

                        strokeWidth: 2.0
                          stroke: Color.LIGHTSKYBLUE;
                        fill: Color.BISQUE;

                    }
            Circle {
                        centerX:(max_x-max_x_sm)/2+700 , centerY: (max_y-max_y_sm)+10;
                        radius: 40
                        fill:RadialGradient  {
                                                centerX:(max_x-max_x_sm)/2+700+2
                                                centerY:(max_y-max_y_sm)+10+5
                                               
                                                radius:40
                                                proportional: true
                                                stops:[
                                                        Stop {color : Color.WHITE offset:0.5},
                                                        Stop {color: Color.YELLOW offset: 1.0},
                                                      ]
                                              }
                        effect: MotionBlur { radius: 10 angle: 100 }


                    }
               
        Group {
blendMode: BlendMode.MULTIPLY;
	content: [

		for(i in [20,40,60,80])
                {
                        Line {
                                startX: i+(max_x-max_x_sm)/2+200, startY: (max_y-max_y_sm)/2+150-10
                                endX: (max_x-max_x_sm)/2+200+i, endY: (max_y-max_y_sm)/2+340+5
                                strokeWidth: 0.5;
                                stroke: Color.BLACK;
                                

                            }

                        }
               for(i in [0,20,40,60,80,100,120,140,160,180])
                {
                       
                        Line {
                                startX:(max_x-max_x_sm)/2+200, startY: (max_y-max_y_sm)/2+340-i
                                endX: (max_x-max_x_sm)/2+280, endY: (max_y-max_y_sm)/2+320-i
                               strokeWidth: 0.5;
                                stroke: Color.BLACK;
                            }

                 }
                for(i in [0,20,40,60])
                {
                        Rectangle {
                                    x: (max_x-max_x_sm)/2+200+i, y: (max_y-max_y_sm)/2+161+i
                                    width: 20, height: 20;
                                    fill: Color.YELLOW;
                                   }
                }
                           Rectangle {
                                x: (max_x-max_x_sm)/2+390-40, y:(max_y-max_y_sm)/2+320-240
                                width: 80, height: 240
                                strokeWidth: 2.0;
                                stroke: Color.LIGHTSKYBLUE;
                                fill: Color.BISQUE;
                                    }
                for(i in [0,40,80,120,160,200,240])

                   {         Ellipse {
                                centerX: (max_x-max_x_sm)/2+390, centerY: (max_y-max_y_sm)/2+320-i
                                radiusX: 40, radiusY: 10
                                strokeWidth: 2.0;
                                //stroke: Color.LIGHTSKYBLUE;
                                fill: Color.BISQUE;
                                     }
                   }

           /* Polygon {
                        points : [ (max_x-max_x_sm)/2+400,(max_y-max_y_sm)/2+500, (max_x-max_x_sm)/2+300,(max_y-max_y_sm)/2+500, (max_x-max_x_sm)/2+250,(max_y-max_y_sm)/2+450, (max_x-max_x_sm)/2+300,(max_y-max_y_sm)/2+400, (max_x-max_x_sm)/2+400,(max_y-max_y_sm)/2+400, (max_x-max_x_sm)/2+450,(max_y-max_y_sm)/2+450 ]
                        fill: Color.YELLOW;
                        strokeWidth: 2.0;
                        stroke: Color.GREEN;
                    }
*/

	]
}
Group {
	content: [
Path {
                    fill: LinearGradient {
                                            startX : (max_x-max_x_sm)/2+100
                                            startY : (max_y-max_y_sm)/2+300
                                            endX : (max_x-max_x_sm)/2+160
                                            endY : (max_y-max_y_sm)/2+300
                                            stops: [
                                            Stop {
                                                    color : Color.AQUA
                                                    offset: 0.0
                                                 },
                                            Stop {
                                                    color : Color.BLUE
                                                    offset: 1.0
                                                  },

                                                    ]
                                        }

                    //fill: Color.BLUE;
                    stroke: Color.AQUA;
                    strokeWidth: 2;

                    effect: Lighting{light: DistantLight{azimuth: 90}}
                    elements:
                    [
                        MoveTo { x: (max_x-max_x_sm)/2+100 y: (max_y-max_y_sm)/2+300 },
                        LineTo { x: (max_x-max_x_sm)/2+110 y: (max_y-max_y_sm)/2+340},
                     
                        LineTo { x: (max_x-max_x_sm)/2+170 y: (max_y-max_y_sm)/2+340},
                        LineTo { x: (max_x-max_x_sm)/2+200 y:(max_y-max_y_sm)/2+300},
                        LineTo { x: (max_x-max_x_sm)/2+110 y: (max_y-max_y_sm)/2+300},
                        LineTo { x: (max_x-max_x_sm)/2+140 y: (max_y-max_y_sm)/2+260},
                        LineTo { x: (max_x-max_x_sm)/2+160 y: (max_y-max_y_sm)/2+300}
                    ]

                     translateX: bind x;
                     translateY: bind y;
                }//Path

		
	]
}
Group {
	content: [
Path {
                    fill: Color.BLUE;
                    stroke: Color.AQUA;
                    strokeWidth: 2;

                    effect: Lighting{light: DistantLight{azimuth: 90}}
                    elements:
                    [
                        MoveTo { x: (max_x-max_x_sm)/2+60 y: (max_y-max_y_sm)/2+490 },
                        LineTo { x: (max_x-max_x_sm)/2+100 y: (max_y-max_y_sm)/2+550},

                        LineTo { x: (max_x-max_x_sm)/2+200 y: (max_y-max_y_sm)/2+550},
                        LineTo { x: (max_x-max_x_sm)/2+240 y:(max_y-max_y_sm)/2+490},
                        LineTo { x: (max_x-max_x_sm)/2+60 y: (max_y-max_y_sm)/2+490},
                        MoveTo { x: (max_x-max_x_sm)/2+90 y: (max_y-max_y_sm)/2+490 },
                        LineTo { x: (max_x-max_x_sm)/2+90 y: (max_y-max_y_sm)/2+400},
                        LineTo { x: (max_x-max_x_sm)/2+180 y: (max_y-max_y_sm)/2+490}

                    ]


                     translateX: bind xship;
                     //translateY: bind y;
                }//Path


	]
}

Group {
	content: [
Line {
	startX: (max_x-max_x_sm)/2+650, startY: (max_y-max_y_sm)+10
	endX: (max_x-max_x_sm)/2+610, endY: (max_y-max_y_sm)+10;
	strokeWidth: 2
	stroke: Color.YELLOW;
      
}


Line {
	startX: (max_x-max_x_sm)/2+650, startY: (max_y-max_y_sm)+50
	endX: (max_x-max_x_sm)/2+620, endY: (max_y-max_y_sm)+70;
	strokeWidth: 2
	stroke: Color.YELLOW;
     
}
Line {
	startX: (max_x-max_x_sm)/2+700, startY: (max_y-max_y_sm)+70
	endX: (max_x-max_x_sm)/2+700, endY: (max_y-max_y_sm)+110;
	strokeWidth: 2
	stroke: Color.YELLOW;
}

	]translateY: bind ysun;
  
}

            /*Text {
                font : Font {size : 16}
                textAlignment: TextAlignment.RIGHT;
                x: 10;y: 30;
                effect: DropShadow { offsetX: 4 offsetY: 4 }
                content: "Application content"
            }*/


        ]
    }
}